package org.mch.swingm.core;

import java.awt.Font;
import java.awt.Insets;

import javax.swing.Action;
import javax.swing.Icon;

import org.jdesktop.swingx.JXButton;

public class MButton extends JXButton {
	private static final long serialVersionUID = 739043599854657256L;

	private int identify = -1;

	public MButton() {
		super();
		initMCH();
	}

	public MButton(String text) {
		super(text);
		initMCH(text);
	}

	public MButton(String text, int identify) {
		super(text);
		this.identify = identify;
		initMCH();
	}

	public MButton(Action a) {
		super(a);
		initMCH();
	}

	public MButton(Icon icon) {
		super(icon);
		initMCH();
	}

	public MButton(String text, Icon icon, int identify) {
		super(text, icon);
		this.identify = identify;
		initMCH();
	}

	public MButton(String text, Icon icon) {
		super(text, icon);
		initMCH();
	}

	protected void initMCH() {
		initMCH(null);
	}

	protected void initMCH(String text) {
		if (text != null) {
			setToolTipText(text);
		}
		setMargin(new Insets(2, 5, 2, 5));//
		setFont(new Font("宋体", Font.PLAIN, 13));//
	}

	public int getIdentify() {
		return identify;
	}

}
